<?php

	/*
		Filename: cp_group.php
		Description: View all students from a selected group.
		
		Last Edit: 13-08-2012 (dd-mm-yyyy)
	*/
	
	// Inlcude database
	require_once("./Config/Config.php");
	
	// Include functions
	require_once("./Config/Functions.php");
	
	// Check if user is logged in as admin
	if(isAdmin() == false) die("This page is only accessible for administrators.");
	
	// Check if the group_name paramter has been set
	if(isset($_GET['group_name']) == false) die("Not set: group_name");
	
	// Get group
	$Group = getGroup(mysql_real_escape_string($_GET['group_name']));
	
	// Show title
	echo '<h1>' . $Group->Name . '</h1>';
	
	echo '<table border="0">';
	echo '<tr><td><b>Name</b></td>';
	echo '<td><b>More</b></td>';
	echo '</tr>';
	
	// Get users
	$Students = getStudents($_GET['group_name']);
	foreach($Students as $Student)
	{
		echo '<tr>';
		echo '<td>' . $Student->Name;
		echo '</td></tr>';
	}
	echo '</table>';
?>	